using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class AbnormInfoMap : EntityTypeConfiguration<AbnormInfo>
	{
		public AbnormInfoMap()
		{
			// Primary Key
			this.HasKey(t => t.AbnormInfoID);

			// Properties
			this.Property(t => t.AbnormType)
				.IsRequired()
				.IsFixedLength()
				.HasMaxLength(4);
				
			this.Property(t => t.AbnormReason)
				.HasMaxLength(200);
				
			this.Property(t => t.Remark)
				.HasMaxLength(200);
				
			this.Property(t => t.AbnormStatus)
				.IsFixedLength()
				.HasMaxLength(4);
				
			this.Property(t => t.DealResult)
				.IsFixedLength()
				.HasMaxLength(10);
				
			this.Property(t => t.ConfirmResult)
				.IsFixedLength()
				.HasMaxLength(10);
				
			// Table & Column Mappings
			this.ToTable("AbnormInfo");
			this.Property(t => t.AbnormInfoID).HasColumnName("AbnormInfoID");
			this.Property(t => t.WayBillNO).HasColumnName("WayBillNO");
			this.Property(t => t.AbnormType).HasColumnName("AbnormType");
			this.Property(t => t.AbnormReason).HasColumnName("AbnormReason");
			this.Property(t => t.SubmittedBy).HasColumnName("SubmittedBy");
			this.Property(t => t.SubmittedStation).HasColumnName("SubmittedStation");
			this.Property(t => t.IsDeal).HasColumnName("IsDeal");
			this.Property(t => t.Remark).HasColumnName("Remark");
			this.Property(t => t.AbnormStatus).HasColumnName("AbnormStatus");
			this.Property(t => t.DealBy).HasColumnName("DealBy");
			this.Property(t => t.DealTime).HasColumnName("DealTime");
			this.Property(t => t.DealStation).HasColumnName("DealStation");
			this.Property(t => t.DealResult).HasColumnName("DealResult");
			this.Property(t => t.ConfirmBy).HasColumnName("ConfirmBy");
			this.Property(t => t.ConfirmTime).HasColumnName("ConfirmTime");
			this.Property(t => t.ConfirmStation).HasColumnName("ConfirmStation");
			this.Property(t => t.ConfirmResult).HasColumnName("ConfirmResult");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatStation).HasColumnName("CreatStation");
			this.Property(t => t.CreatTime).HasColumnName("CreatTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateStation).HasColumnName("UpdateStation");
		}
	}
}

